#ifndef READYQUE_H
#define READYQUE_H
#define NUM_OF_PROCESS 6

#include <QWidget>
#include <QPushButton>
#include <QDebug>
#include <algorithm>
#include <QDialog>
#include "sprocess.h"
#include "readyinfodialog.h"

namespace Ui {
class ReadyQue;
}

class ReadyQue : public QWidget
{
    Q_OBJECT

public:
    explicit ReadyQue(QWidget *parent = 0);
    ~ReadyQue();
    void InitReady();
    void ReceiveReadyProcs(SProcess *receiveProcs);
    void ReceiveReadyProcsWithSlice(SProcess *receiveProcs);
    SProcess * PopReadyProcs();
    SProcess * PopReadyProcsWithSlice();
    void SortReadyProcs();
    static bool cmp(SProcess *a, SProcess *b);
    void delAllBtn();
    void layAllbtns();
    void refreshAllbtns();
    void refreshAllbtnsWithSlice();
    void connectBtnProcs();
    void initBtns();
    void BtnStyle(QPushButton *btn);

    int getMax_Procs() const;
    SProcess **getReadyQue();
    SProcess *getMaxPrioProcs();
    void addPriOfAllWait();
    void delSpecifiedProcsInReady(SProcess *specified);
    void delSpecifiedProcsInReadyWithSlice(SProcess *specified);

private:
    Ui::ReadyQue *ui;
    int Max_Procs;
    QPushButton *btns[NUM_OF_PROCESS];
    SProcess *ready[NUM_OF_PROCESS];
    ReadyInfoDialog *infordialog;

private slots:
    void btn_0_clicked();
    void btn_1_clicked();
    void btn_2_clicked();
    void btn_3_clicked();
    void btn_4_clicked();
    void btn_5_clicked();

};

#endif // READYQUE_H
